# -*- coding: utf-8 -*-

from autoscrapy.items import mongo_plugin as item_plugin
from autoscrapy.utils import log


LOG = log.get_logging(__name__)

class item(object):

    def __init__(self, context):
        self._context = context
        self._item_plugins = item_plugin.item(context)

    @property
    def item(self):
        return self._item_plugins

    def add_item(self, content):
        if not content:
            return
        try:
            self.item.add_item(content)
        except Exception as e:
            LOG.error("add item %s fail", content)
            LOG.exception("add item occure exception %s", e)
